<div class="container">
 
        <h1 id="pkg-overview">package quick</h1>

        <p><code>import "testing/quick"</code>

        </p><p>
Package quick implements utility functions to help with black box testing.
</p>
<p>
The testing/quick package is frozen and is not accepting new features.</p>


        
  


        
        

        

        

        
        
          
        

        
        


<p><a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go">quick.go</a> </p>

        
        

        
        

        
        
        
          <h2 data-kind="f" id="Check">func <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L258" title="View Source">Check</a>  </h2>
          <p>
Check looks for an input to f, any function that returns bool,
such that f returns false. It calls f repeatedly, with arbitrary
values for each argument. If f returns false on a given input,
Check returns that input as a *CheckError.
For example:
</p>
<pre>func TestOddMultipleOfThree(t *testing.T) {
	f := func(x int) bool {
		y := OddMultipleOfThree(x)
		return y%2 == 1 &amp;&amp; y%3 == 0
	}
	if err := quick.Check(f, nil); err != nil {
		t.Error(err)
	}
}
</pre>

          
  

        
          <h2 data-kind="f" id="CheckEqual">func <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L297" title="View Source">CheckEqual</a>  </h2>
          <p>
CheckEqual looks for an input on which f and g return different results.
It calls f and g repeatedly with arbitrary values for each argument.
If f and g return different answers, CheckEqual returns a *CheckEqualError
describing the input and the outputs.
</p>

          
  

        
          <h2 data-kind="f" id="Value">func <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L56" title="View Source">Value</a>  </h2>
          <p>
Value returns an arbitrary value of the given type.
If the type implements the Generator interface, that will be used.
Note: To create arbitrary values for structs, all the fields must be exported.
</p>

          
  

        

        
        

        
          <h2 data-kind="t" id="CheckEqualError">type <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L233" title="View Source">CheckEqualError</a>  </h2>
          <p>
A CheckEqualError is the result CheckEqual finding an error.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="CheckEqualError.Error">func (*CheckEqualError) <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L239" title="View Source">Error</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="CheckError">type <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L223" title="View Source">CheckError</a>  </h2>
          <p>
A CheckError is the result of Check finding an error.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="CheckError.Error">func (*CheckError) <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L228" title="View Source">Error</a>  </h3>
            
            
  

          
        
          <h2 data-kind="t" id="Config">type <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L174" title="View Source">Config</a>  </h2>
          <p>
A Config structure contains options for running a test.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="Generator">type <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L22" title="View Source">Generator</a>  </h2>
          <p>
A Generator can generate random values of its own type.
</p>

          
          
          
  


          

          
        
          <h2 data-kind="t" id="SetupError">type <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L218" title="View Source">SetupError</a>  </h2>
          <p>
A SetupError is the result of an error in the way that check is being
used, independent of the functions being tested.
</p>

          
          
          
  


          

          
            <h3 data-kind="m" id="SetupError.Error">func (SetupError) <a href="https://github.com/golang/go/blob/master/src/testing/quick/quick.go#L220" title="View Source">Error</a>  </h3>
            
            
  
<div class="clearfix" id="x-footer">
  <div class="container">
    <a href="http://studygolang.com/" target="_blank">Go语言中文网</a>
    <span class="text-muted">|</span> <a href="http://golang.org/" target="_blank">Go Language</a>
    <span class="pull-right"><a href="#">Back to top</a></span>
  </div>
</div>
<script src="../assets/jquery-2.0.3.min.js"></script>
<script src="../assets/bootstrap.min.js"></script>
<script src="../assets/site.js"></script>


</div>